package com.king.content;

import com.king.annotation.Component;
import com.king.annotation.ComponentScan;
import com.king.annotation.ComponentScans;

import java.io.File;
import java.lang.annotation.Annotation;
import java.net.URL;

/**
 * 自定义 ApplicationContent
 *
 * @packageNme com.king.content
 * @Author: jinguoguang
 * @Date: 2024/5/29 10:18
 * @Version: v1.0.0
 **/
public class KingApplicationContent {
    private Class configClass;

    public KingApplicationContent(Class configClass) {
        this.configClass = configClass;
        // if (configClass.isAnnotationPresent(ComponentScan.class)) {
        //     ComponentScan componentScan = (ComponentScan) configClass.getAnnotation(ComponentScan.class);
        //     // 获取路径
        //     String path = componentScan.value();
        //     System.out.println("path = " + path);
        //     ClassLoader classLoader = KingApplicationContent.class.getClassLoader();
        //     URL resource = classLoader.getResource("com/king/service");
        //     File file = new File(resource.getFile());
        //     if (file.isDirectory()) {
        //         File[] files = file.listFiles();
        //         for (File f : files) {
        //             System.out.println(f);
        //             Class<?> aClass = classLoader.loadClass("..");
        //             if (aClass.isAnnotationPresent(Component.class)) {
        //
        //             }
        //
        //         }
        //     }
        // }
        // 扫描
    }

    public Object getBean(String beanName) {
        return null;
    }
}
